package com.design.pattern.strategy;

/**
 * @Description 返现的逻辑
 * @author ll
 * @createTime 2021/5/31  23:53 
 */
public class CrashReturn extends Crash{

	/**
	 * 满300返100  moneyCondition=300，moneyReturn=100
	 */
	private double moneyCondition = 0.0d;
	private double moneyReturn = 0.0d;

	public CrashReturn(String moneyCondition,String moneyReturn){
		this.moneyCondition = Double.parseDouble(moneyCondition);
		this.moneyReturn = Double.parseDouble(moneyReturn);
	}

	@Override
	public double resultCrash(double money) {
		return money - ((int)(money/moneyCondition) * moneyReturn);
	}

}
